﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="author" content="Aowork">
    <meta name="description" content="">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no">

    <title></title>

    <link href="../css/mobile.css" rel="stylesheet" />

    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
    <script src="../js/zepto.min.js"></script>
    <script src="../js/zepto.swipe.js"></script>
    <script src="../js/common.js"></script>
    <script src="../js/config.js"></script>
    <script src="../js/uiExtend.js"></script>
    <script src="../js/wx_config.js"></script>

    <script type="text/javascript">
        jc.fnInit.push(function () {
            jc.ui.header.trigger("updateTitle", "设置家长");
        });
    </script>


    <script type="text/javascript">
        jc.fnInit.push(function () {
            jc.ui.header.trigger("getUser", function (user) {

                $.getJSON(window.path.profile, { accessToken: user.accessToken, userId: user.uid }, function (result) {

                    if (!result.success) {
                        window.errorRouter(result.desc);
                    }

                    var data = result.data;


                    jc.ui.form.trigger("ready", data);

                });
            });
        });
    </script>

    <script type="text/javascript">
        window.btnGroupClick = function () {

            function checkPhone(phone) {
                if ((/^1[34578]\d{9}$/.test(phone))) {
                    return true;
                }
            }

            jc.ui.form.trigger("confim", function (data) {

                if (!data) {
                    alert("亲！你是不是忘了填点什么东西了?");
                    return false;
                }

                if (!checkPhone(data.parentPhoneNo)) {
                    alert("亲！手机号码格式不正确");
                    return false;
                }


                jc.ui.header.trigger("getUser", function (user) {
                    data.accessToken = user.accessToken;
                    data.uid = user.uid;

                    $.getJSON(window.path.profileUpdate, data, function (result) {
                        if (result.success) {
                            alert("设置成功");
                            window.location.replace(window.ctx + "home/home.html");
                        }
                        else {
                            window.errorRouter(result.desc);
                        }
                    });
                });

            });

        }
    </script>

</head>
<body>

    <div data-ui="header" class="J_header">
        <div class="h_inner"></div>
    </div>

    <div class="pt10 bgfff bb1">
        <div data-ui="form" class="J_form">
            <div data-id="parentName" class="f_item">
                <div class="i_input">
                    <input placeholder="请输入家长名字" maxlength="6" type="text">
                </div>
            </div>

            <div data-id="parentPhoneNo" class="f_item">
                <div class="i_input">
                    <input placeholder="请输入家长手机号码" maxlength="11" type="tel">
                </div>
            </div>
        </div>


        <div data-ui="btnGroup" class="J_btnGroup p10">
            <a class="abtn green" href="javascript:;">提交</a>
        </div>
    </div>






</body>
</html>
